#include "addradio.h"
#include "ui_addradio.h"
#include "mainwindow.h"
#include "logger.h"

AddRadio::AddRadio(QWidget *parent) :
    QDialog(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint),
    ui(new Ui::AddRadio), m_entry(NULL)
{
    ui->setupUi(this);
}

AddRadio::~AddRadio()
{
    delete ui;
}

void AddRadio::on_cmdok_clicked()
{
    if(ui->txtName->text().isEmpty() || ui->txtUrl->text().isEmpty())
        return;

    m_entry = new xplEntry(ui->txtName->text(), ui->txtUrl->text());

    ((MainWindow*)this->parent())->AddEntry(m_entry);
    this->close();
}

void AddRadio::on_cmdCancle_clicked()
{
    qLog.info("Form AddRadio wird geschlossen");
    this->close();
}
